<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>周日计划</title>
    <link rel="stylesheet" href="../../res/layui/css/layui.css" media="all">
    <script type="text/javascript" src="../../res/js/Tools.js"></script>
    <script src="../../res/js/jquery-3.4.1.min.js" type="text/javascript"
            charset="utf-8"></script>
    <script src="../../res/js/login_common.js" charset="utf-8"></script>
    <script src="../../res/layui/layui.js" charset="utf-8"></script>
    <style>
        #btn:hover{
            background: #33aba0;
            cursor: pointer;
        }
        #btn{
            background: #009688;
            color: white;
            width: 100px;
            height: 36px;
            border: 0;
        }
        #btno:hover{
            background: #33aba0;
            cursor: pointer;
        }
        #btno{
            background: #009688;
            color: white;
            width: 100px;
            height: 36px;
            border: 0;
        }
        #btnt:hover{
            background: #33aba0;
            cursor: pointer;
        }
        #btnt{
            background: #009688;
            color: white;
            width: 100px;
            height: 36px;
            border: 0;
        }
        #add:hover{
            cursor: pointer;
            background: #1e9fff;
        }
        .black_overlay{
            display: none;
            position: absolute;
            top: 0%;
            left: 0%;
            width: 100%;
            height: 100%;
            background-color: black;
            z-index:1001;
            -moz-opacity: 0.8;
            opacity:.80;
            filter: alpha(opacity=80);
        }
        .white_content {
            display: none;
            position: absolute;
            top: 10%;
            left: 10%;
            width: 80%;
            height: 80%;
            border: 16px solid lightblue;
            background-color: white;
            z-index:1002;
            overflow: auto;
        }
        #add {
            width: 70px;
            height: 36px;
            float: right;
            margin-bottom: -36px;
            margin-right: 10px;
            border-radius: 2%;
            font-size: 8px;
            background: #1c80d0;
            color: white;
            text-align: center;
            line-height: 36px;
        }

        .layui-form-item .layui-input-inlinetwo {
            float: left;
            width: 130px;
            margin-right: 10px;
        }

        #cilicili span:hover{
            cursor: pointer;
        }
        .blala span:hover{
            cursor: pointer;
        }
        #bindone span:hover{
            cursor: pointer;
        }
        #bindtwo span:hover{
            cursor: pointer;
        }
        #blala span:hover{
            cursor: pointer;
        }
        #bindthree span:hover{
            cursor: pointer;
        }
        #loveyouni span:hover{
            cursor: pointer;
        }
        .layui-form-item .layui-input-inlinethree {
            float: left;
            width: 182px;
            margin-right: 10px;
        }
        #closeone:hover{
            cursor: pointer;
        }
    </style>
    <script>
        $.ajaxSetup({
            async : false
        });
        $(function(){
            var coachId=loginObj.manager.filId;
            $("#coachId").val(coachId);
            var creater=loginObj.manager.manUser;
            $("#creater").val(creater);
            var i=0;
            $("#add").click(function(){
                i++;
                $("#er").prepend('<div class="layui-form-item" id="three'+i+'">\n' +
                    '        <div class="layui-inline">\n' +
                    '            <label class="layui-form-label" >指标名称</label>\n' +
                    '            <div class="layui-input-inlinetwo" >\n' +
                    '                <input type="text" name="itemName" ondblclick="ShowDiv(\'MyDiv\',\'fade\',this)"  lay-verify="required" id="itemNam'+i+'"  autocomplete="off" class="layui-input">\n' +
                    '            </div>\n' +
                    '        </div>\n' +
                    '        <div class="layui-inline" id="cilicili">\n' +
                    '            <span style="font-size: 30px;color: red" class="'+i+'" onclick="dj('+i+')">×</span>\n' +
                    '            <label class="layui-form-label" >指标值</label>\n' +
                    '            <div class="layui-input-inlinetwo" >\n' +
                    '                <input type="text" id="heifenni'+i+'" name="itemValue" lay-verify="required|number" id="itemValue autocomplete="off" class="layui-input">\n' +
                    '            </div>\n' +
                    '        </div>\n' +
                    '    </div>')
            })
            $("#btn").click(function () {
                $("#fileone").click();
                $("#fileone").change(function(obj){
                    var fileInput = $('#fileone').get(0).files[0];//获取input控件的file
                    if(fileInput){
                        $("#ts").html(fileInput.name);
                    }
                });

            });
            $("#btno").click(function () {
                $("#filetwo").click();
                $("#filetwo").change(function(obj){
                    var fileInput = $('#filetwo').get(0).files[0];//获取input控件的file
                    if(fileInput){
                        $("#tsone").html(fileInput.name);
                    }
                });
            });
            $("#btnt").click(function () {
                $("#filethree").click();
                $("#filethree").change(function(obj){
                    var fileInput = $('#filethree').get(0).files[0];//获取input控件的file
                    if(fileInput){
                        $("#tstwo").html(fileInput.name);
                    }
                });
            });

        })
        function clicktwo(obj){
            if($("#itemValue").val()){
                layer.confirm('指标值已经填值,确认删除吗?', function (index) {
                    $("#Nice").remove();
                    layer.close(index);
                });
            }else{
                $("#Nice").remove();
            }
        }
        function clicktwot(obj){
            if($("#itemValueyell").val()){
                layer.confirm('指标值已经填值,确认删除吗?', function (index) {
                    $("#Nicetwo").remove();
                    layer.close(index);
                });
            }else{
                $("#Nicetwo").remove();
            }
        }
        function clicktwott(obj){
            if($("#itemValueshout").val()){
                layer.confirm('指标值已经填值,确认删除吗?', function (index) {
                    $("#Nicethree").remove();
                    layer.close(index);
                });
            }else{
                $("#Nicethree").remove();
            }
        }
        function dj(obj){
            if($("#heifenni"+obj).val()){
                layer.confirm('指标值已经填值,确认删除吗?', function (index) {
                    var b=$("."+obj).prop("class");//取出这个选择器里面的属性方法
                    $("#three"+b).remove();
                    $("."+obj).remove();
                    layer.close(index);
                });
            }else{
                var b=$("."+obj).prop("class");//取出这个选择器里面的属性方法
                $("#three"+b).remove();
                $("."+obj).remove();
            }

        }
        function djo(obj){
            var b=$("#"+obj).prop("id");//取出这个选择器里面的属性方法
            $("#four"+b).remove();
        }
        function shanchu(obj){
            //询问框
            layer.confirm('您确定删除此行指标名以及指标值？', {
                btn: ['确定', '取消'] //按钮
            }, function () {
                //取出这个选择器里面的属性方法
                var b=$("#ccc"+obj).prop("id");
                //只截取数字的方法
                var number=b.match(/\d+/g);
                var x1 = document.getElementById("tractor"+number).innerText;
                var url="../../../atsPlanWeekController/deleteZhibiao";
                var data={itemId:x1};
                $.post(url,data,function(obj){
                    if(obj.num==1){
                        $("#five"+number).remove();
                        layer.msg('删除成功!', { icon: 1 });
                    }else{
                        layer.msg(obj.msg);
                    }
                },"json");
            }, function () {
                layer.msg('你取消了此操作!', { icon: 1 });
            });

        }
        //弹出隐藏层
        function ShowDiv(show_div,bg_div,objs){
            var bbid=objs.id;
            var values=$("#"+bbid).val();
            if(values){
                return false;
            }else{
                document.getElementById(show_div).style.display='block';
                document.getElementById(bg_div).style.display='block' ;
                var bgdiv = document.getElementById(bg_div);
                bgdiv.style.width = document.body.scrollWidth;
                // bgdiv.style.height = $(document).height();
                $("#"+bg_div).height($(document).height());
                var url="../../../atsPlanWeekController/findDivone";
                var data=null;
                $.post(url,data,function(obj){
                    var cc=0;
                    //id选择器下面所有的button按钮
                    $("#MyDiv button").remove();
                    $.each(obj,function(index,item){
                        cc++;
                        $("#MyDiv").append("<button type=\"button\" id='btn"+cc+"' onclick=\"btnAdd('"+cc+"','"+objs.id+"')\" style='margin-top: 10px;margin-left: 10px' class=\"layui-btn layui-btn-normal\">"+item.itemName+"</button>\n");
                    });
                },"json");
            }


        };
        function btnAdd(obj,id){
            $("#"+id).val($("#btn"+obj).text());
            CloseDiv('MyDiv','fade');
        }
        //关闭弹出层
        function CloseDiv(show_div,bg_div)
        {
            document.getElementById(show_div).style.display='none';
            document.getElementById(bg_div).style.display='none';
        }
    </script>
</head>
<body>
<!--弹出层时背景层DIV-->
<div id="fade" class="black_overlay">
</div>
<div id="MyDiv" class="white_content">
    <div style="text-align: right; cursor: default; height: 40px;" >
        <span style="font-size: 40px;" id="closeone" onclick="CloseDiv('MyDiv','fade')">×</span>
    </div>
</div>
<form class="layui-form" action="" id="formDId" lay-filter="example" method="post" enctype="multipart/form-data">
    <input type="hidden" name="weekId" id="weekId">
    <input type="hidden" name="file1" id="file1">
    <input type="hidden" name="file2" id="file2">
    <input type="hidden" name="file3" id="file3">
    <input type="hidden" name="sportId" id="sportId">
    <input type="hidden" name="sportName" id="sportName">
    <input type="hidden" name="coachId" id="coachId">
    <input type="hidden" name="athleteId" id="athleteId">
    <input type="hidden" name="athleteName" id="athleteName">
    <input type="hidden" name="creater" id="creater">
    <input type="hidden" name="itemNameone" id="itemNameone">
    <input type="hidden" name="itemValueone" id="itemValueone">
    <div class="layui-form-item">
        <div class="layui-inline">
            <label class="layui-form-label">计划名称</label>
            <div class="layui-input-inlinethree">
                <input type="text" name="weekName"    lay-verify="required"  Maxlength="50"  id="weekName" lay-verify="title" autocomplete="off" placeholder="请输入计划名称" class="layui-input">
            </div>
        </div>

        <div class="layui-inline">
            <label class="layui-form-label">其他教练员</label>
            <div class="layui-input-inlinethree">
                <input type="text" name="otherCoach" Maxlength="50"  id="otherCoach" lay-verify="title" autocomplete="off" placeholder="输入其他教练员名字" class="layui-input">

            </div>
        </div>

        <div class="layui-inline">
            <label class="layui-form-label">请选择阶段</label>
            <div class="layui-input-inlinethree">
                <select id="phaseId" name="phaseId"   lay-verify="required">
                    <option value=""></option>
                </select>
            </div>
        </div>

        <div class="layui-inline">
            <label class="layui-form-label">制定时间</label>
            <div class="layui-input-inlinethree">
                <input type="text" class="layui-input"   lay-verify="required" style="margin-bottom: 20px" id="planDate" name="planDate" placeholder="请输入制定时间">
            </div>
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-inline">
            <label class="layui-form-label">运动员:</label>
            <div id="checkBox1" class="layui-input-block">

            </div>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">计划描述</label>
        <div class="layui-input-block" style="margin-top: 10px">
            <textarea placeholder="请输入计划描述" required lay-verify="required" Maxlength="1000" class="layui-textarea" name="planDescribe" id="planDescribe"></textarea>
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">周训练任务</label>
        <div class="layui-input-block">
            <textarea placeholder="请输入周训练任务" required lay-verify="required" Maxlength="1000" class="layui-textarea" name="weekMission" id="weekMission"></textarea>
        </div>
    </div>


    <div class="layui-form-item">
        <label class="layui-form-label" style="font-size: 13px">周训练重点</label>
        <div class="layui-input-block">
            <textarea placeholder="请输入周训练重点" required lay-verify="required" Maxlength="1000" class="layui-textarea" name="weekEmphasis" id="weekEmphasis"></textarea>
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-inline">
            <label class="layui-form-label" style="color: red">*附件1</label>
            <div class="layui-input-inline">
                <input type="file" name="fileone" style="display: none" id="fileone"  autocomplete="off"
                       class="layui-input">
                <button id="btn"  type="button" >上传文件</button>
                <a id="ts" target="_blank" style="text-decoration:none"></a>
            </div>
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-inline">
            <label class="layui-form-label">附件2</label>
            <div class="layui-input-inline">
                <input type="file" name="filetwo" style="display: none" id="filetwo"  autocomplete="off"
                       class="layui-input">
                <button id="btno"  type="button" >上传文件</button>
                <a id="tsone" target="_blank" style="text-decoration:none"></a>
            </div>
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-inline">
            <label class="layui-form-label">附件3</label>
            <div class="layui-input-inline">
                <input type="file" name="filethree" style="display: none" id="filethree"  autocomplete="off"
                       class="layui-input">
                <button id="btnt"  type="button" >上传文件</button>
                <a id="tstwo" target="_blank" style="text-decoration:none"></a>
            </div>
        </div>
    </div>
    <div  id="add">增加指标</div>
    <div class="layui-form-item" >
        <div id="loveyou">
            <div id="Nice">
                <div class="layui-inline" >
                    <label class="layui-form-label">指标名称</label>
                    <div class="layui-input-inlinetwo" >
                        <input type="text" name="itemName" value="运动量" lay-verify="required" id="itemName" ondblclick="ShowDiv('MyDiv','fade',this)"  autocomplete="off" class="layui-input">
                    </div>
                </div>
                <div class="layui-inline" id="bindone">
                    <!--<span style="font-size: 30px" id="add">＋</span>-->
                    <span style="font-size: 30px;color: red "  onclick="clicktwo(this)">×</span>
                    <label class="layui-form-label">指标值</label>
                    <div class="layui-input-inlinetwo" >
                        <input type="text" name="itemValue" lay-verify="required|number"  id="itemValue" autocomplete="off" class="layui-input">
                    </div>
                </div>
            </div>
            <div id="Nicetwo">
                <div class="layui-inline" >
                    <label class="layui-form-label">指标名称</label>
                    <div class="layui-input-inlinetwo" >
                        <input type="text" name="itemName" lay-verify="required" value="运动负荷"  ondblclick="ShowDiv('MyDiv','fade',this)"  autocomplete="off" class="layui-input">
                    </div>
                </div>
                <div class="layui-inline" id="bindtwo">
                    <!--<span style="font-size: 30px" id="add">＋</span>-->
                    <span style="font-size: 30px;color: red"  onclick="clicktwot(this)">×</span>
                    <label class="layui-form-label">指标值</label>
                    <div class="layui-input-inlinetwo" >
                        <input type="text" name="itemValue" id="itemValueyell" lay-verify="required|number"   autocomplete="off" class="layui-input">
                    </div>
                </div>
            </div>
            <div id="Nicethree">
                <div class="layui-inline" >
                    <label class="layui-form-label">指标名称</label>
                    <div class="layui-input-inlinetwo" >
                        <input type="text" name="itemName" lay-verify="required" value="运动强度"  ondblclick="ShowDiv('MyDiv','fade',this)"  autocomplete="off" class="layui-input">
                    </div>
                </div>
                <div class="layui-inline" id="bindthree">
                    <!--<span style="font-size: 30px" id="add">＋</span>-->
                    <span style="font-size: 30px;color: red"  onclick="clicktwott(this)">×</span>
                    <label class="layui-form-label">指标值</label>
                    <div class="layui-input-inlinetwo" >
                        <input type="text" name="itemValue" id="itemValueshout" lay-verify="required|number"   autocomplete="off" class="layui-input">
                    </div>
                </div>
            </div>

        </div>
        <div id="er"></div>

    <div class="layui-form-item">
        <div class="layui-input-block">
            <button type="button" class="layui-btn site-demo-active" lay-submit lay-filter="formDemo">立即提交</button>
            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
        </div>
    </div>
    </div>
</form>
<script>
    layui.use('laydate', function(){
        var laydate = layui.laydate;
        //时间范围
        laydate.render({
            elem: '#planDate'
            ,type: 'date'
        });
    });
    var form=null;
    layui.use('form', function(){
        form = layui.form;

        //监听提交
        form.on('submit(formDemo)', function(data){
            var checkOne = false;                    //判断是否被选择条件
            var chboxVal = [];                       //存入被选中项的值
            var checkBox = $('input[name = checkboxone]'); //获得得到所的复选框

            for (var i = 0; i < checkBox.length; i++) {

                //如果有1个被选中时（jquery1.6以上还可以用if(checkBox[i].prop('checked')) 去判断checkbox是否被选中）
                if (checkBox[i].checked) {
                    checkOne = true;
                    chboxVal.push(checkBox[i].value)//将被选择的值追加到
                };
            };
            if (!checkOne) {
                layer.msg("对不起：至少要选择一个运动员哦!");
                return false;
            }


            var fileInput = $('#fileone').get(0).files[0];//获取input控件的file
            var ide = getQueryString("id");
            if(ide== null || ide == undefined || ide == ''){
                if(fileInput== null || fileInput == undefined || fileInput == ''){
                    $("#ts").html('文件不能为空');
                    layer.msg('文件不能为空!', { icon: 6 });
                    return false;
                }  else{
                    $("#ts").html('');
                }
            }
            // 单击之后提交按钮不可选,防止重复提交
            var DISABLED = 'layui-btn-disabled';
            // 增加样式
            $('.site-demo-active').addClass(DISABLED);
            // 增加属性
            $('.site-demo-active').attr('disabled', 'disabled');
            var id = "";
            var title="";
            $("input[name='checkboxone']:checked").each(function(index,items){
                id+=$(this).val()+",";
                title+=$(this).prop("title")+",";
            });
            $("#athleteId").val(id);
            $("#athleteName").val(title);
            /*
              指标名字封装
             */
            var itemName= $("input[name=itemName]").map(function () { return this.value; }).get().join(",");
            /*
              指标值封装
             */
            var itemValue= $("input[name=itemValue]").map(function () { return this.value; }).get().join(",");
            $("#itemNameone").val(itemName);
            $("#itemValueone").val(itemValue);
            var formData = new FormData(document.getElementById("formDId"));
            var url="../../../atsPlanWeekController/addOrupdate";
            $.ajax({
                url:url,
                type:"post",
                data:formData,
                processData:false,
                contentType:false,
                dataType:"json",
                success:function(obj){
                    if(obj.num==1){
                        layer.msg(obj.msg,{
                            icon:1,
                            time:1000 //1秒关闭(如果不配置默认三秒)
                        },function(){
                            //关闭当前层
                            //当你在iframe页面关闭自身时
                            parent.layui.table.reload("test");
                            var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
                            parent.layer.close(index); //再执行关闭
                            //刷新父页面
                            //parent.location.reload();
                        });
                        return false ;
                    }
                },
                error:function(e){
                    layer.msg("错误！！");
                }
            });
            return false;
        });
        loadSportTypetwo();
        findSportId();
        athlete();
        var ide = getQueryString("id");
        var pid = getQueryString("pid");
        if(pid){
            var url="../../../atsPlanWeekController/findMaxPid";
            var data={coachId:$("#coachId").val()};
            $.post(url,data,function(obj){
                var urlone="../../../atsPlanWeekController/findPlanItemYearMore";
                var pid=obj.weekId;
                var dataone={pid:pid};
                $.post(urlone,dataone,function(objs){
                    var b=0;
                    $.each(objs,function(index,item){
                        if(item.itemName=="运动量"){
                            $("#Nice").remove();
                        }else if(item.itemName=="运动负荷"){
                            $("#Nicetwo").remove();
                        }else if(item.itemName=="运动强度"){
                            $("#Nicethree").remove();
                        }
                        b++;
                        $("#er").append('<div class="layui-form-item" id="four'+b+'">\n' +
                            '        <div class="layui-inline">\n' +
                            '            <label class="layui-form-label" >指标名称</label>\n' +
                            '            <div class="layui-input-inlinetwo" >\n' +
                            '                <input type="text"  name="itemName" lay-verify="required" ondblclick="ShowDiv(\'MyDiv\',\'fade\',this)" value="'+item.itemName+'" id="itemNa'+b+'"  autocomplete="off" class="layui-input">\n' +
                            '            </div>\n' +
                            '        </div>\n' +
                            '        <div class="layui-inline" id="loveyouni">\n' +
                            '    <span style="font-size: 30px;color: red" id="'+b+'" onclick="djo('+b+',)">×</span>\n' +
                            '            <label class="layui-form-label" >指标值</label>\n' +
                            '            <div class="layui-input-inlinetwo" >\n' +
                            '                <input type="text" name="itemValue" lay-verify="required|number"  id="itemValue" autocomplete="off" class="layui-input">\n' +
                            '            </div>\n' +
                            '        </div>\n' +
                            '    </div>')

                    });

                },"json");
            },"json");
        }

        if(ide!=null){
            $("#loveyou").remove();
            updatePlanItem();
            findById();//修改页面的赋值
            checboxfu();//复选框赋值
            var str=$("#file1").val();
            var strone=$("#file2").val();
            var strtwo=$("#file3").val();
            if(str.length>1){
                $("#ts").text(str.substring(0,13)+"。。。。。 ."+str.match(/\.([^\.]+)$/)[1]);
                $("#ts").prop("href","../../../"+str);
            }
            if(strone.length>1){
                $("#tsone").html(strone.substring(0,13)+"。。。。。 ."+strone.match(/\.([^\.]+)$/)[1]);
                $("#tsone").prop("href","../../../"+strone);
            }
            if(strtwo.length>1){
                $("#tstwo").html(strtwo.substring(0,13)+"。。。。。 ."+strtwo.match(/\.([^\.]+)$/)[1]);
                $("#tstwo").prop("href","../../../"+strtwo);
            }
        }
    });
    //点击编辑出现选中的指标值和名称
    function updatePlanItem(){
        var id=getQueryString("id");
        var url="../../../atsPlanWeekController/findPlanItemYearMoreone";
        var data={pid:id};
        $.post(url,data,function(obj){
            var b=0;
            $.each(obj,function(index,item){
                b++;
                $("#er").append('<div class="layui-form-item" id="five'+b+'">\n' +
                    '        <div class="layui-inline">\n' +
                    '            <label class="layui-form-label" >指标名称</label>\n' +
                    '            <div class="layui-input-inlinetwo" >\n' +
                    '                <input type="text" name="itemName" lay-verify="required" ondblclick="ShowDiv(\'MyDiv\',\'fade\',this)"  value="'+item.itemName+'"  id="item'+b+'"  autocomplete="off" class="layui-input">\n' +
                    '            </div>\n' +
                    '        </div>\n' +
                    '        <div class="layui-inline">\n' +
                    '        <span style="display: none" id="tractor'+b+'">'+item.itemId+'</span></span><div style="display: inline" id="blala"><span style="font-size: 30px;color: red" id="ccc'+b+'" onclick="shanchu('+b+')">×</span></div>\n' +
                    '            <label class="layui-form-label" >指标值</label>\n' +
                    '            <div class="layui-input-inlinetwo" >\n' +
                    '                <input type="text" name="itemValue"  lay-verify="required|number" value="'+item.itemValue+'"  id="itemValue autocomplete="off" class="layui-input">\n' +
                    '            </div>\n' +
                    '        </div>\n' +
                    '    </div>')
            });
        },"json");
    }


    function findSportId(){
        //首先查出专业外键，根据专业查专业名字
        var urlFour="../../../atsPlanYearMoreController/findCoachexp";
        var dataFour={coachId:$("#coachId").val()};
        $.post(urlFour,dataFour,function(obj){
            $("#sportId").val(obj.expertSpecia);
            //查体育专业名字
            var url="../../../atsPlanYearMoreController/findCoachexpone";
            var data={sportId:obj.expertSpecia};
            $.post(url,data,function(objs){
                $("#sportName").val(objs.sportName);
            },"json");
        },"json");
    }
    function athlete(){
        var urlFour="../../../atsPlanYearMoreController/selectAthlete";
        var dataFour={coachId:$("#coachId").val()};
        $.post(urlFour,dataFour,function(obj){
            $.each(obj,function(index,item){
                $("#checkBox1").append("<input type='checkbox' id='cc"+item.athleteId+"'  name='checkboxone' title='" + item.athleteName + "' value='" + item.athleteId + "'>");
                form.render("checkbox");
            });
        },"json");
    }
    /**
     * 复选框赋值
     */
    function checboxfu(){
        var id=getQueryString("id");
        var url="../../../atsPlanYearMoreController/findByIdpidFour";
        var data={pid:id};
        $.post(url,data,function(obj){
            $.each(obj,function(index,item){
                $("#cc"+item.athleteId).attr("checked","checked");
                form.render("checkbox");
            })
        },"json");
    }

    //加载阶段表下拉框
    function loadSportTypetwo(){
        var url="../../../atsPlanPhaseController/findAllTwo";
        var data={creater:$("#creater").val()};
        $.post(url,data,function(obj){
            $.each(obj,function(index,item){
                $("#phaseId").append("<option value='"+item.phaseId+"'>"+item.phaseName+"</option>");
            });
            form.render('select');
        },"json");

    }
    //修改页面的赋值
    function findById(){
        var id=getQueryString("id");
        var url="../../../atsPlanWeekController/findById";
        var data={weekId:id};
        $.post(url,data,function(obj){
            $("#weekId").val(obj.weekId);
            $("#weekName").val(obj.weekName);
            $("#phaseId").val(obj.phaseId);
            $("#otherCoach").val(obj.otherCoach);
            $("#weekMission").val(obj.weekMission);
            $("#weekEmphasis").val(obj.weekEmphasis);
            $("#planDescribe").val(obj.planDescribe);
            $("#remark").val(obj.remark);
            $("#planDate").val(obj.planDate);
            $("#file1").val(obj.file1);
            $("#file2").val(obj.file2);
            $("#file3").val(obj.file3);
            form.render('select');
        },"json");

    }
</script>
</body>
</html>